/imports ...
/imports/codemirror ...
active-line.js
brace-fold.js
closebrackets.js
closetag.js
codemirror.css
codemirror.js
comment-fold.js
comment.js
continuecomment.js
css.js
dialog.css
dialog.js
foldcode.js
foldgutter.css
foldgutter.js
html-hint.js
htmlembedded.js
htmlmixed.js
indent-fold.js
javascript-hint.js
javascript.js
match-highlighter.js
matchbrackets.js
search.js
searchcursor.js
show-hint.css
show-hint.js
tern.js
trailingspace.js
xml-fold.js
xml-hint.js
xml.js
/imports/knockout
knockout-3.0.0.js
/imports/typescript
lib.d.ts
typescriptServices.js
/imports/zip.js
deflate.js
inflate.js
zip.js
/layout
file.html
folder.html
page.html
teapo.css
/typings
codemirror.d.ts
knockout.d.ts
typescriptServices.d.ts
websql.d.ts
zip.js.d.ts
TypeScriptService.ts
editor-std.ts
editor-x-css.ts
editor-x-html.ts
editor-x-js.ts
editor-x-ts.ts
editor.ts
files.ts
ko.ts
persistence.ts
shell.ts
teapo.html
teapo.js
teapo.ts
632
577
    if (ts.options.showError)
578
      ts.options.showError(cm, msg);
579
    else
580
      tempTooltip(cm, String(msg));
581
  }
582
 
583
  function closeArgHints(ts) {
584
    if (ts.activeArgHints) { remove(ts.activeArgHints); ts.activeArgHints = null; }
585
  }
586
 
587
  function docValue(ts, doc) {
588
    var val = doc.doc.getValue();
589
    if (ts.options.fileFilter) val = ts.options.fileFilter(val, doc.name, doc.doc);
590
    return val;
591
  }
592
 
593
  // Worker wrapper
594
 
595
  function WorkerServer(ts) {
596
    var worker = new Worker(ts.options.workerScript);
597
    worker.postMessage({type: "init",
598
                        defs: ts.options.defs,
599
                        plugins: ts.options.plugins,
600
                        scripts: ts.options.workerDeps});
601
    var msgId = 0, pending = {};
602
 
603
    function send(data, c) {
604
      if (c) {
605
        data.id = ++msgId;
606
        pending[msgId] = c;
607
      }
608
      worker.postMessage(data);
609
    }
610
    worker.onmessage = function(e) {
611
      var data = e.data;
612
      if (data.type == "getFile") {
613
        getFile(ts, data.name, function(err, text) {
614
          send({type: "getFile", err: String(err), text: text, id: data.id});
615
        });
616
      } else if (data.type == "debug") {
617
        console.log(data.message);
618
      } else if (data.id && pending[data.id]) {
619
        pending[data.id](data.err, data.body);
620
        delete pending[data.id];
621
      }
622
    };
623
    worker.onerror = function(e) {
624
      for (var id in pending) pending[id](e);
625
      pending = {};
626
    };
627
 
628
    this.addFile = function(name, text) { send({type: "add", name: name, text: text}); };
629
    this.delFile = function(name) { send({type: "del", name: name}); };
630
    this.request = function(body, c) { send({type: "req", body: body}, c); };
631
  }
632
})();